The present invention relates to an information storing apparatus such as a magnetic disk drive or the like for writing data transferred by a write command from a host onto a medium. More particularly, the invention relates to an information storing apparatus for receiving data of write commands subsequent to a plurality of write command successively issued from a host during the writing of data onto a medium and processing it.
In an information storing apparatus known as a hard disk, when a host writes data onto the hard disk, the host issues a write command, the hard disk requests the host to generate data in response to the write command, stores the data into a data buffer, and writes the data onto a disk medium upon completion of data reception. When the writing of the data onto the disk medium is completed, the hard disk reports a status indicative of an execution result of the write command to the host and the write command is completed. In the write command from the host, information indicative of a write start address and the number of write blocks is shown. A hard disk drive recognizes the write command by an MCU through a host interface. The data from the host is temporarily stored into a data buffer and written onto the disk medium on a block unit basis. The status is reported by the two following methods:
I. a data reception command completing method of reporting the status at the time of completion of the data reception and completing the write command; and
II. a medium write command completing method of reporting the status at the time of completion of the writing of the data onto the disk and completing the write command.
According to the data reception command completing method, by finishing the write command upon completion of the data reception from the host, it is made easy to start the process of the next write command. That is, it is a command completing method whereby a command is issued to prewrite data in the data buffer. On the contrary, the medium write command completing method is a command completing method of writing data where the host confirms whether the data has normally been written onto the disk medium or not.
When a plurality of write commands are successively issued, the hard disk drive rearranges the plurality of commands in order from the write command of a short access time before execution of the plurality of write commands, thereby improving the command processing ability. Once the execution is started, the executing order is not changed after that. The start of the execution in this case denotes the start of data reception.
The data buffer is divided into some blocks called segments. The write command or read command of data is executed by using one segment. A purpose of dividing the data buffer into a plurality of blocks is that at the time of execution of the read command, data of the read command or subsequent data is held in the data buffer and, when the read command of the data held in the data buffer is issued as a subsequent command, the data is not read out from the disk medium but transferred directly from the data buffer to the host, thereby shortening a command process.
A purpose of prewriting data in the data reception command completing method is that all or a part of the write data has already been received into the data buffer before the completion of the movement of the head to the head sector of the issued write command, and the waiting of the disk medium due to the absence of the write data in the data buffer is reduced. That is, when data is not prewritten in the data buffer, the data has to be received during the movement of the head to the target sector. When the data is prewritten, the writing time of data onto the disk medium by the preceding write command is also included in the receiving time of the prewrite data from the host, so that there is sufficient time for data reception, and the waiting due to the absence of the write data in the data buffer does not easily occur. The execution of the data prewrite has, however, the following problems.
FIGS. 1A and 1B show a flow of data when write commands of two blocks are issued from the host in the data reception command completing method of completing the write command at a point when the reception of the write data is completed. FIG. 1A shows a host interface and two write commands CMD1 and CMD2 which designate data of two blocks are successively issued. When the reception of the write commands CMD1 and CMD2 is completed at time t1, the hard disk drive receives data D11 and D12 of two blocks from the host by execution of the write command CMD1, stores them into the data buffer, reports a status STS1 to the host upon completion of the data reception, and finishes the write command CMD1 at time t2. The reception of data D21 and D22 of the next write command CMD2 is consequently started and stored as prewrite data into the data buffer. A status STS2 is reported upon completion of the data reception, thereby completing the write command CMD2 at time t4.
FIG. 1B shows a disk interface. In parallel to the reception of the data D11 and D12 of two blocks from the host, a head movement to a target sector designated by the write command CMD1 is started and the writing of the data onto the disk medium is completed at time t3. As mentioned above, in the data reception command completing method of completing the command at a point when the reception of the write data is completed, since it is unnecessary to report a result of the data writing onto the disk medium to the host, a process of the next write command can be easily started in what is called a data prewrite. When the writing of data onto the disk medium fails in the data reception command completing method, however, since the initial write command has already been finished, a failure in the command is reported to the host without executing the write command next to the write command by which the data was finally prewritten. When a failure occurs in the disk writing of a plurality of commands successively issued from the host, only the command which finally fails is reported. There is consequently a problem such that the host has to perform the rewriting for all of the commands before the reported command. In order to solve the problem, the disk write command completing method in which the host can confirm that the data has normally been written onto the disk medium is usually adopted.
FIGS. 2A and 2B show a flow of data when write commands of two blocks are issued from the host in the disk write command completing method of completing a command upon completion of writing of data onto the disk. FIG. 2A shows a host interface. The two write commands CMD1 and CMD2 designating data of two blocks are successively issued. When the reception of the write commands CMD1 and CMD2 is completed at time t1, the hard disk drive receives the data D11 and D12 of two blocks from the host by the execution of the write command CMD1 and stores them into the data buffer. FIG. 2B shows a disk interface. When the reception of the data D11 and D12 of two blocks from the host is completed at time t2, the head movement to the target sector designated by the write command CMD1 is started and the writing of the data D11 and D12 onto the disk medium is completed at time t3. Upon completion of the disk writing, the host interface reports the status STS1 to the host, thereby completing the write command CMD1. Subsequently, the data D21 and D22 by the write command CMD2 is received and, after the head movement, the data is written onto the disk. In recent years, however, the number of systems to each of which a plurality of hosts and a plurality of targets (hard disk drive and the like) are connected has been increasing. When prewriting of data is not performed, data reception is delayed because another target and the host are communicating, and a disadvantage such that data cannot be received until the head movement to the target sector is completed has been becoming unignorable.
As shown in FIGS. 1A and 1B, in case of prewriting data in the data reception command completing method, since time that is required from the command reception to the start of the data reception is short, there is a possibility that the executing order of the write commands for the disk writing is not optimized but the execution of the commands is started. If the executing order is not optimized, there is a possibility that the processing ability deteriorates more than the case where the prewrite is not executed.
As shown in FIGS. 2A and 2B, when the data is not prewritten in the medium write command completing method, the successive write commands are processed by using one segment in the data buffer, so that data in the other segments is not destroyed. As shown in FIGS. 1A and 1B, however, when the data prewrite is performed according to the data reception command completing method, since a plurality of segments are used, there is a possibility that read data which has already been stored in each segment is lost and the reading performance deteriorates.
According to the invention, there is provided an information storing apparatus in which data is prewritten even when a write command is finished upon completion of writing of data onto a disk medium, thereby assuring write data in a data buffer and improving the processing ability.
According to the invention, there is provided an information storing apparatus in which the writing order of data onto a disk when data of a plurality of write commands is received is optimized and a buffer area which is used by the command by which data is being written to the disk and that which is used by a prewrite data are equalized, thereby improving command processing ability by the prewriting of data.
According to the invention, there is provided an information storing apparatus in which a write command issued from a host is finished by completion of the writing onto a medium, comprising: a command receiving unit for receiving a plurality of write commands successively issued from the host and storing them into a command queue; a data receiving unit for receiving data from the host by the execution of the write command from a head position in the command queue and storing it into a data buffer; a medium writing unit for starting to write the reception data onto the medium upon completion of the data reception by the data receiving unit; a status reporting unit for reporting a status to the host upon completion of the data writing by the medium writing unit and finishing the write command which is being executed; and a prewrite processing unit for receiving the data from the host as prewrite data and storing it into the data buffer by the execution of the next write command without waiting for completion of the writing of the reception data onto the medium by the medium writing unit.
As mentioned above, according to the information storing apparatus of the invention, in case of finishing the write command upon completion of the writing onto the disk medium, if the reception of the data of the command which is being executed is completed for a plurality of write commands successively issued from the host, the reception of the data of the next command is started without waiting for the completion of the writing onto the disk medium, so that the command processing ability can be improved. That is, in the conventional apparatus for finishing the write command by the completion of the writing onto the disk medium, a delay of the disk writing process that is caused because of the absence of the write data in the data buffer is likely to occur when the access time is short or when a plurality of apparatuses are connected and becomes a factor of deterioration of the processing ability. However, since the prewrite data is assured in the data buffer according to the invention, the deterioration in processing performance is eliminated and the stable processing ability can be derived.
The data reception of the write commands after the write command which is being executed is defined as prewriting of data and the write command which executes data prewrite is defined as xe2x80x9cprewrite write commandxe2x80x9d.
The information storing apparatus of the invention further comprises: a next command receiving pointer P1 indicative of a storing position of a next command to be received for the command queue; a data receiving pointer P2 showing a command at the start of the reception of data from the host or during the data reception; a medium writing pointer P3 showing a command at the start of writing of the data onto the medium from the data buffer or during the data writing; and a status reporting pointer P4 indicative of a command to subsequently report a status. The next command receiving pointer P1 is advanced upon completion of the command reception by the command receiving unit. The data receiving pointer P2 is advanced upon completion of the data reception by the data receiving unit. The medium writing pointer P3 is advanced upon completion of the medium writing by the medium writing unit. Further, the status reporting pointer P4 is advanced upon completion of the status report by the status reporting unit. The next command receiving pointer P1, data receiving pointer P2, medium writing pointer P3, and status reporting pointer P4 are sequentially arranged. Whenever each pointer advances, the process shown by the advanced pointer is executed.
The information storing apparatus of the invention has an optimization processing unit for rearranging the executing order of a plurality of prewrite write commands in order from the prewrite write command in which the access time is short, thereby optimizing them in the case where a plurality of prewrite write commands in each of which the prewrite data has already been received exist in the command queue. The optimization processing unit obtains the access time of the prewrite write command as a time that is required from the completion of the medium writing of the preceding write command until the start of the medium writing of the next write command, and changes the executing order to the order from the short access time, thereby optimizing. In the case where a plurality of data received prewrite write commands exist in the command queue, by changing the executing order of the prewrite write commands to the order from the short access time as mentioned above, the command processing ability can be improved. That is, in the conventional prewrite data process, since the optimization of the executing order is inadequate, in order to prevent the deterioration of the processing ability and the deterioration of the processing ability of the data read command due to the destruction of the prewrite data, there has been used a countermeasure such that an MPU of high performance is provided for the hard disk drive to thereby perform the optimization in a short time, the number of prewrite data is increased by using a data buffer of a large capacity, or the like. According to the invention, however, the command processing ability can be improved by optimizing the executing order of the prewrite write commands without using expensive hardware.
According to the information storing apparatus of the invention, when the data buffer is divided into a plurality of areas and a plurality of write commands successively issued from the host are stored into the command queue, a buffer area which is used by the write command during the writing of data onto the disk and a buffer area which is used by the prewrite write command are made identical. For example, when the data buffer is divided into a plurality of areas each having a predetermined size and each area is finely divided into subareas by a predetermined size based on the data stored by the first write command and a plurality of write commands successively issued from the host are stored into the command queue, a subarea of a specific buffer area is used for each of the write command during the writing of data onto the disk and the prewrite write command. When the data buffer is divided into a plurality of areas each having a predetermined size and a plurality of write commands successively issued from the host are stored into the command queue, the specific buffer area can be divided into subareas and used in accordance with the data size of each of the write command during the writing of data onto the disk and the prewrite write command. By making the buffer area which is used for the write command during the writing of data onto the disk and the buffer area that is used by the prewrite write command identical as mentioned above, the prewrite data is received in a vacant area in the buffer area used by the first one of the plurality of write commands. The data prewrite is realized without breaking the prewrite data stored in the other areas.
Another embodiment of the invention relates to an information storing apparatus in which a write command issued from a host is finished by completion of data reception from the host. The information storing apparatus of such a data reception command completing method comprises: a command receiving unit for plurality of write commands successively issued from a host and storing them into a command queue; a data receiving unit for receiving data by the execution of the write command from the head position of the command queue and storing it into a data buffer; a status reporting unit for reporting a status to the host upon completion of the data reception by the data receiving unit, thereby finishing the write command which is being executed; a medium writing unit for starting to write the reception data onto the medium upon completion of the data reception by the data receiving unit; and an optimization processing unit for rearranging an executing order of a plurality of prewrite write commands to the order from the prewrite write command in which an access time is short, thereby optimizing them in the case where a plurality of prewrite write commands in which the prewrite data has already been received exist in the command queue. The optimization processing unit obtains an access time of the prewrite write command as a time that is required from the completion of the writing of data onto the medium of the preceding write command until the start of the writing of data onto the medium of the next write command and changing the executing order to the order of the prewrite write command in which the access time is short, thereby optimizing them. In the case where a plurality of data received prewrite write commands exist in the command queue, by changing the executing order of the prewrite write commands to the order from the prewrite write command in which the access time is short as mentioned above, the command processing ability can be improved. According to the information storing apparatus, when the data buffer is divided into a plurality of areas and a plurality of write commands successively issued from the host are stored into the command queue, a buffer area which is used by the write command during the writing of data onto the disk and a buffer area which is used by the prewrite write command are made identical. For example, when the data buffer is divided into a plurality of areas each having a predetermined size and each area is further finely divided into subareas each having a predetermined size based on the data stored by the execution of the first write command and a plurality of write commands successively issued from the host are stored into the command queue, the subarea in the specific buffer area is used for each of the write command during the writing of data onto the disk and the prewrite write command. When the data buffer is divided into a plurality of areas each having a predetermined size and a plurality of write commands successively issued from the host are stored into the command queue, the specific buffer area can be divided into subareas in accordance with the data size of each of the write command during the writing of data onto the disk and the prewrite write data and used. By making the buffer area which is used by the write command during the writing of data onto the disk and the buffer area which is used by the prewrite write command identical as mentioned above, the prewrite data is received in a vacant area in the buffer area used by the first one of the plurality of write commands. Thus, the data prewrite is realized without destroying the prewrite data existing in the other areas.
The above and other objects, features, and advantages of the present invention will become more apparent from the following detailed description with reference to the drawings.